<?php

	/**
	 *@author:Khuong
	 *@version:2012-11-19 15:45
	 */

	define('_DOCUMENT_ROOT_', dirname(realpath(__FILE__)).'/');
	
	/******* define smarty lib folder*******/
	require_once('../smarty/libs/Smarty.class.php');
	require_once(_DOCUMENT_ROOT_.'inc/config_front.php');
	require_once(_DOCUMENT_ROOT_.'lib/search_functions.php');
	require_once(_DOCUMENT_ROOT_.'inc/db_functions.php');
	
	/******* initialize smarty *******/
	$smarty = new Smarty();
	
	/******* initialize db functions *******/
	$db = new db_functions();
	
	/******* define smarty template folder *******/
	$smarty->setTemplateDir(_DOCUMENT_ROOT_.'../smarty/templates');
	$smarty->setCompileDir(_DOCUMENT_ROOT_.'../smarty/templates_c');
	$smarty->setCacheDir(_DOCUMENT_ROOT_.'../smarty/cache');
	
	/******* read from xml file *******/
	if(file_exists(_DOCUMENT_ROOT_.'inc/test.xml'))
	{
		$xml_file = simplexml_load_file(_DOCUMENT_ROOT_.'inc/test.xml');
		
		$area = array();
		$country = array();
		$city = array();
		
		foreach($xml_file->portal as $portal)
		{
			$area[] = $portal->attributes()->id;
		}
		/******* portal *******/
		$area = array_unique($area);
		/******* region *******/
		$region = $_ARRAY_AREA_;

	}
	else
	{
		exit('Failed to open file');
	}
	

    //assign values to template
	$smarty->assign('area', $area);
	$smarty->assign('mySelect','02A');
	$smarty->assign('region',$region);
	$smarty->assign('mySelect','default');
	
	//display template
	$smarty->display('sethotkeyword.tpl');	
?>